//
//  CarShipTaxRequest.m
//  EasyToo
//
//  Created by YuanDee on 13-9-12.
//
//

#import "CarShipTaxRequest.h"

@implementation CarShipTaxRequest
-(id)initWithLicensePlateNumber:(NSString *)license
                andDisplacement:(NSString *)displacement
                      andAmount:(NSString*)amount
                      andMobile:(NSString*)mobile
                       Delegate:(id<ServerCommunicationDelegate>)delegate
{
    self = [super init];
    if(self)
    {
        self.requestName = @"CarShipTaxRequest";
        self.licensePlateNumber = license;
        self.displacement = displacement;
        self.delegate = delegate;
        self.url = PROTOCOL_ORDER_URL;

        NSMutableDictionary *entry_dict2 = [[[NSMutableDictionary alloc] init] autorelease];
        [entry_dict2 setObject:@"1" forKey:@"Ver"];
        [entry_dict2 setObject:@"0" forKey:@"Transaction"];
        [self.bodyJsonDict setObject:entry_dict2 forKey:@"Head"];
        
        [self.bodyJsonDict setObject:amount forKey:@"amount"];
        [self.bodyJsonDict setObject:mobile forKey:@"mobile"];
        [self.bodyJsonDict setObject:displacement forKey:@"volume"];
        [self.bodyJsonDict setObject:license forKey:@"license"];
        [self.bodyJsonDict setObject:@"21218cca77804d2ba1922c33e0151105" forKey:@"password"];
        
        [self.headerJsonDict setObject:@"021001" forKey:@"TranCode"];
        [self.headerJsonDict setObject:[NSString stringWithFormat:@"%d", amount.intValue * 100] forKey:@"TxAmt"];



        [self buildJsonRequest];
    }
    return self;
}

-(void)dealloc
{
    self.licensePlateNumber = nil;
    self.displacement = nil;
    [super dealloc];
}

@end
